Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of unified privileges checking for CLI commands #1504

Closed
wants to merge 6 commits into from

Conversation

jan-kolarik
Copy link
Member

@jan-kolarik jan-kolarik commented May 21, 2024

Using the existing RPM lock file functionality.

There are a hard-coded list of commands that are not allowed to run without superuser privileges. Then assumeno and downloadonly options are taken into account. Lastly, we check if provided command has defined the store option which should be defined for all transactional commands and therefore it should mean a need for elevated privileges.

For: #849.

Drop from `clean` command as it is not transactional and add it to `builddep`.
The functionality is needed by both the library and the dnf5 app.
@jan-kolarik jan-kolarik force-pushed the jkolarik/superuser-privileges-checking branch from 476c48b to 576363c Compare May 21, 2024 16:02
@jan-kolarik
Copy link
Member Author

jan-kolarik commented May 21, 2024

Actually, I think adding some suffix to the lock file path will be needed in case of testing the write privileges. That would still test the write access in the same directory, but not touching the existing transaction file potentially created by the concurrent dnf instance ...

EDIT: Done.

A single checkpoint was implemented after parsing command-line data but before downloading metadata and processing commands, ensuring unified handling of cases where commands are executed under insufficient privileges.
@jan-kolarik jan-kolarik force-pushed the jkolarik/superuser-privileges-checking branch from 576363c to 8bd3e2b Compare May 22, 2024 08:26
@jan-kolarik
Copy link
Member Author

/packit copr-build

@jan-kolarik jan-kolarik force-pushed the jkolarik/superuser-privileges-checking branch from 8bd3e2b to 06a0aa0 Compare May 22, 2024 10:05
@jan-kolarik
Copy link
Member Author

jan-kolarik commented May 22, 2024

I am creating a new PR (#1505) to address this as the Packit Copr repo is broken due to previous additional fixes.

@m-blaha m-blaha deleted the jkolarik/superuser-privileges-checking branch May 30, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant